<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.control.EmployeesControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
      request.setCharacterEncoding("UTF-8");
      Employees employees=(Employees)session.getAttribute("user");
      int id=employees.getId();
      String userName=EmployeesControl.getEmpolyeesById(id).getUsername();
      String passWord1 = ParamUtil.getString(request,"passWord1");
      String passWord2 = ParamUtil.getString(request,"passWord2");
      
      if(passWord1.equals(passWord2)){
         employees.setUsername(userName);
         employees.setPassword(passWord1);
         System.out.print(passWord1);
         if(EmployeesControl.updatePassword(employees)){
%>
<script>
alert("修改成功")
<%
     session.invalidate();
%>
window.location.href="../../login/login.jsp";
</script>
<%         
         }
      }else{
%>
<script>
alert("密码不符");
window.location.href="employees_update_mima.jsp";
</script>
<%
      }
%>


</body>
</html>